﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
    input[type=date]::-webkit-inner-spin-button {
        visibility: hidden;
    }
</style>
<script>
    $(function () {
        var time = new Date();
        var day = ('0' + time.getDate()).slice(-2);
        var month = ('0' + (time.getMonth() + 1)).slice(-2);
        var firstDay = time.getFullYear() + '-' + month + '-01';
        var today = time.getFullYear() + '-' + month + '-' + day;
        $('#startDate').val(firstDay);
        $('#endDate').val(today);
        $('#startDate').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });

        $('#endDate').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            minView: 2,
            forceParse: 0
        });

        gridList();
        $("#gridList").jqGrid('setLabel', 'rn', '序号', { 'text-align': 'center', 'vertical-align': 'middle' });
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Gas/FaceRecord/GetGridJson",
            height: $(window).height() - 96,
            postData: { 'StartDate': $("#startDate").val(), 'EndDate': $("#endDate").val(), 'txtResult': $("#txtResult").val() },
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                { label: '姓名', name: 'RName', width: 50, align: 'left' },
                { label: '身份证号', name: 'IDNumber', width: 150, align: 'left' },
                { label: '就餐时间', name: 'RecordTime', width: 150, align: 'left' },
                { label: '满意度', name: 'Satisfaction', width: 150, align: 'left' },
                { label: '是否刷卡', name: 'Result', width: 150, align: 'left' },
                { label: '联系方式', name: 'Telephone', width: 150, align: 'left' },
                @*{ label: '联系方式2', name: 'Telephone2', width: 150, align: 'left' },*@
            ],
            pager: "#gridPager",
            sortname: 'RecordTime desc',
            viewrecords: true,
            prmNames: {}
        });
        $("#btn_search").click(function () {
            var startDt = $("#startDate").val();
            var endDt = $("#endDate").val();
            $gridList.jqGrid('setGridParam', {
                postData: { RName: $("#txtRName").val(), IDNumber: $("#txtIDNumber").val(), StartDate: startDt, EndDate: endDt, txtResult: $("#txtResult").val()},
            }).trigger('reloadGrid');
        });
    }
    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Details",
            title: "查看记录",
            url: "/Gas/FaceRecord/Details?keyValue=" + keyValue,
            width: "550px",
            height: "620px",
            btn: null,
        });
    }
    function btn_download() {
        window.open("/Gas/FaceRecord/ExplortFaceRecordInfo?StartDate=" + $("#startDate").val() + "&EndDate=" + $("#endDate").val() + "&RName=" + $("#txtRName").val() + "&IDNumber=" + $("#txtIDNumber").val() + "&txtResult=" + $("#txtResult").val());
    }
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="btn_download()"><span class="glyphicon glyphicon-download"></span>&nbsp;导出</a>
        </div>
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">

        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-edit" onclick="btn_details()"><i class="fa fa-pencil-square-o"></i>详情</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txtRName" type="text" class="form-control" placeholder="姓名" style="width: 100px;">&nbsp;&nbsp;&nbsp;&nbsp;
                        <input id="txtIDNumber" type="text" class="form-control" placeholder="身份证号" style="width: 200px;">
                        <input type="text" value="" id="startDate" class="form-control" data-date-format="yyyy-mm-dd" style="width: 150px;">
                        <input type="text" value="" id="endDate" class="form-control" data-date-format="yyyy-mm-dd" style="width: 150px;">
                        <select id="txtResult" class="form-control" style="width:150px">
                            <option value="0" title="全部">全部</option>
                            <option value="已刷卡" title="已刷卡" selected>已刷卡</option>
                            <option value="未刷卡" title="未刷卡">未刷卡</option>
                        </select>
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
